The present invention relates to a moving picture encoding method and a moving picture encoding apparatus for compressing and encoding a moving picture, and more particularly, to a moving picture encoding method and a moving picture encoding apparatus for detecting a frame in which a scene changes, and conducting compression with high coding efficiency.
In recent years, with the progress of digital technology, it has become possible to record and regenerate a moving picture, and to transmit a moving picture using a communication network. Since a digital signal of a moving picture has much more information content than that of a voice signal, a high efficiency encoding technology for a moving picture is indispensable for recording and transmitting the digital signal with high efficiency.
For example, in a moving picture encoding apparatus having a Moving Picture Experts Group (referred to as a xe2x80x9cMPEGxe2x80x9d, hereinafter) method, an image of each frame is predicted in a prediction mode of any one of an I frame, a P frame and a B frame, and a predictive error is encoded and transmitted. Since basically only the predictive error is transmitted, compared with a case in which an image data of each frame is transmitted as it is, a data content can be compressed.
By the way, in the conventional moving picture encoding apparatus, when a sequence consisting of a plurality of scenes is compressed, it is necessary not to conduct predictive coding by crossing over discontinuous scenes. If the predictive coding is conducted by crossing over a scene change, since prediction becomes to be conducted between the frames having low correlation, coding efficiency gets worse and image quality is deteriorated.
To solve such a task, it is necessary to exactly detect a position where the scenes are switched, and not to conduct predictive coding between the frames having low correlation.
With regard to a method of detecting a scene change, as disclosed in JP-A-111631/1995 for example, there is a general method in which differences between continuous two frames are obtained for every pixel data, and it is determined that a scene change occurs when a sum total of their absolute values exceeds a predetermined threshold value.
In this detection method, when a first scene in a stationary state or which only moves slightly, and a second scene that moves somewhat larger than the first scene alternately occur, occurrence of the scene change is detected. However, in such a case, since there is some correlation between the frames, coding efficiency sometime becomes higher if interframe predictive coding is conducted. However, in the conventional method, since, if the scene change is detected, the interframe predictive coding is not made to be conducted, there is a task that coding efficiency gets worse.
Also, in the conventional method, since the scene change is detected based on the correlation with the previous frame, there is a task that erroneous detection occurs if frame interpolation in which the same frames are continuously input is conducted.
Moreover, in a detection method disclosed in JP-A-193818/1995, motion prediction of an input image is conducted, and a sum of absolute values of errors in the prediction is obtained, and an average value obtained by averaging a sum of absolute values of the prediction errors for each frame over a plurality of frames is compared with a sum of absolute values of the individual prediction errors, and thereby, a scene change is detected. However, even in this detection method, there is a task that it does not deal with an input to which frame interpolation has been applied.
The objective of the present invention is to solve the above-described tasks.
Also, the objective of the present invention is to provide a moving picture encoding method and a moving picture encoding apparatus that are capable of appropriately detecting a scene change, and conducting compression with good coding efficiency.
A moving picture encoding method of the present invention comprises steps of: after calculating an absolute value of a difference for every corresponding pixel data between continuous two frames, calculating an average value per frame and an average value per scene of the above-described absolute value of the difference; and comparing the average value per frame with the average value per scene, and detecting a scene change of a moving picture.
Also, in one example of an arrangement of the moving picture encoding method, in case that the above-described average value per frame is smaller than a predetermined lower limit value, after this average value per frame is updated to the lower limit value, the updated average value is compared with the average value per scene. In this manner, by setting the lower limit value when the average value per frame is calculated, erroneous detection of a small change on a screen can be avoided, and it is possible to exactly detect the scene change.
Also, in one example of an arrangement of the moving picture encoding method, in case that the above-described absolute value of the difference is larger than a predetermined upper limit value, after the absolute value of the difference is updated to the upper limit value, the average value per frame and the average value per scene are calculated. In this manner, by setting the upper limit value when the absolute value of the difference is calculated for every pixel data, since to increase an average value of a whole frame is prevented even for a scene in which there is locally a large change on a part of a screen, erroneous detection can be avoided, and it is possible to exactly detect the scene change.
Also, in one example of an arrangement of the moving picture encoding method, in case that the above-described average value per frame is zero, after the average value per frame is updated to an average value per frame, which was calculated just before, the updated average value is compared with the average value per scene. In this manner, in case that the average value per frame is zero, by using the average value per frame, which was calculated just before, since to make the average value per scene go wrong is prevented by excluding the case in which the average value per frame is zero, erroneous detection can be avoided, and it is possible to exactly detect the scene change even in a case in which the same frames are continuously input because an input frame rate is lower than an output frame rate, and frame interpolation is needed.
Also, in one example of an arrangement of the moving picture encoding method, in compressing a moving picture by combining intra-frame coding, which conducts coding with processing within a frame, with interframe predictive coding using a reference frame before or after with respect to time, in case that the above-described scene change is detected, interframe predictive coding is not conducted. In this manner, in case that the scene change is detected in compressing the moving picture, by changing a frame type so that the intra-frame coding is conducted without conducting the predictive coding between frames having low correlation, since the predictive coding does not become to be conducted by crossing over discontinuous scenes, it is possible to conduct compression with good coding efficiency.
Also, in one example of an arrangement of the moving picture encoding method, when the above-described average value per frame is more than or equal to a predetermined number times as large as the average value per scene, it is determined that the above-described scene change has occurred.
Also, in one example of an arrangement of the moving picture encoding method, the absolute value of the difference is calculated for each of a luminance component and a color difference component.
Also, in one example of an arrangement of the moving picture encoding method, in case that the above-described absolute value of the difference is less than or equal to a predetermined upper limit value and is less than or equal to a predetermined lower value, after the absolute value of the difference is updated to the lower limit value, the average value per frame and the average value per scene are calculated. In this manner, by setting the upper and lower limit values when the absolute value of the difference is calculated for every pixel data, even though there is a part in an input image in which a change content is locally large, the influence thereof on an average value per frame can be suppressed, and it is possible to suppress the erroneous detection of a scene change.
Moreover, a moving picture encoding apparatus of the present invention comprises: calculation means for, after calculating an absolute value of a difference for every corresponding pixel data between continuous two frames, calculating an average value per frame and an average value per scene of the absolute value of the difference; and determination means for comparing the average value per frame with the average value per scene, and detecting a scene change of a moving picture.
Also, in one example of an arrangement of the moving picture encoding apparatus, in case that the above-described average value per frame is smaller than a predetermined lower limit value, the above-described calculation means updates the average value per frame to the lower limit value.
Also, in one example of an arrangement of the moving picture encoding apparatus, in case that the above-described absolute value of the difference is larger than a predetermined upper limit value, after updating the absolute value of the difference to the upper limit value, the above-described calculation means calculates the average value per frame and the average value per scene.
Also, in one example of an arrangement of the moving picture encoding apparatus, in case that the above-described average value per frame is zero, the above-described calculation means updates the average value per frame to an average value per frame, which was calculated just before.
Also, in one example of an arrangement of the moving picture encoding apparatus, in compressing a moving picture by combining intra-frame coding, which conducts coding with processing within a frame, with interframe predictive coding using a reference frame before or after with respect to time, the apparatus further includes means for making interframe predictive coding not to be conducted in case that the scene change is detected by the above-described determination means.
Also, in one example of an arrangement of the moving picture encoding apparatus, when the above-described average value per frame is more than or equal to a predetermined number times as large as the average value per scene, the above-described determination means determines that the scene change has occurred.
Also, in one example of an arrangement of the moving picture encoding apparatus, the above-described calculation means calculates the absolute value of the difference for each of a luminance component and a color difference component.
Also, in one example of an arrangement of the moving picture encoding apparatus, in case that the above-described absolute value of the difference is less than or equal to a predetermined upper limit value and is less than or equal to a predetermined lower value, after updating the absolute value of the difference to the lower limit value, the calculation means calculates the average value per frame and the average value per scene.